#-----------------------------------------------------------------------------------------#
# Function: prepare_p_ls()                                                                #
# Description: prepares data for the synth function - primary and lower secondary school  #
#-----------------------------------------------------------------------------------------#

prepare_p_ls <- function(data){
  library(Synth)
  
  predictors <- c("homicides", "TWh", "ln_pop", "unemployment", "edu_invest_pc")
  
  DATA_PM <- dataprep(foo = data,
                      predictors = predictors,
                      dependent     = "score",
                      unit.variable = "code_state",
                      time.variable = "year",
                      unit.names.variable = "abbr_state",
                      treatment.identifier  = 23,
                      controls.identifier   = c(11:17, 21:22, 24:29, 31:33, 35, 41:43, 50:53),
                      time.predictors.prior = seq(1995, 2007, 2),
                      time.optimize.ssr     = seq(1995, 2007, 2),
                      time.plot             = seq(1995, 2019, 2))
 
  return(DATA_PM)
}